/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "rolprovider")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Rolprovider.findAll", query = "SELECT r FROM Rolprovider r"),
    @NamedQuery(name = "Rolprovider.findByRolProviderId", query = "SELECT r FROM Rolprovider r WHERE r.rolProviderId = :rolProviderId"),
    @NamedQuery(name = "Rolprovider.findByName", query = "SELECT r FROM Rolprovider r WHERE r.name = :name")})
public class Rolprovider implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "rolProviderId")
    private Integer rolProviderId;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rolProviderId")
    private Collection<Userprovider> userproviderCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rolprovider")
    private Collection<Defaultaccessprovider> defaultaccessproviderCollection;

    public Rolprovider() {
    }

    public Rolprovider(Integer rolProviderId) {
        this.rolProviderId = rolProviderId;
    }

    public Rolprovider(Integer rolProviderId, String name) {
        this.rolProviderId = rolProviderId;
        this.name = name;
    }

    public Integer getRolProviderId() {
        return rolProviderId;
    }

    public void setRolProviderId(Integer rolProviderId) {
        this.rolProviderId = rolProviderId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public Collection<Userprovider> getUserproviderCollection() {
        return userproviderCollection;
    }

    public void setUserproviderCollection(Collection<Userprovider> userproviderCollection) {
        this.userproviderCollection = userproviderCollection;
    }

    @XmlTransient
    public Collection<Defaultaccessprovider> getDefaultaccessproviderCollection() {
        return defaultaccessproviderCollection;
    }

    public void setDefaultaccessproviderCollection(Collection<Defaultaccessprovider> defaultaccessproviderCollection) {
        this.defaultaccessproviderCollection = defaultaccessproviderCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (rolProviderId != null ? rolProviderId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rolprovider)) {
            return false;
        }
        Rolprovider other = (Rolprovider) object;
        if ((this.rolProviderId == null && other.rolProviderId != null) || (this.rolProviderId != null && !this.rolProviderId.equals(other.rolProviderId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Rolprovider[ rolProviderId=" + rolProviderId + " ]";
    }
    
}
